package com.sos.widget.binding;

import android.text.TextUtils;

import androidx.databinding.BindingAdapter;

import com.sos.widget.view.SettingBar;

/**
 * @Description
 * @Author 梁浩文
 * @Date 2022/9/13 16:09
 */
public class SettingBarBinding {
    @BindingAdapter(value = {"saas_setting_left_text_color", "saas_setting_right_text_color", "saas_setting_left", "saas_setting_right","saas_setting_hide_line"}, requireAll = false)
    public static void settingBarBinding(SettingBar view, int leftTextColor, int rightTextColor, String leftText, String rightText, boolean hideLine) {
        if (view != null) {
            if (leftTextColor != 0) {
                view.setLeftColor(leftTextColor);
            }
            if (rightTextColor != 0) {
                view.setRightColor(rightTextColor);
            }
            if (!TextUtils.isEmpty(leftText)) {
                view.setLeftText(leftText);
            }
            if (!TextUtils.isEmpty(rightText)) {
                view.setRightText(rightText);
            }
            view.setLineVisible(!hideLine);
        }
    }
}
